/**
*传输js
*/ 

var	transfersDS;
var transfersFormPanel;
var choosedTransferID = "";
function doTransferDelete(id)
{
	Ext.MessageBox.confirm('确认删除', '确认删除该信息?', 
	function(btn) {
		if(btn == 'yes') // 选中了是按钮	
		{
			JTransfersWeb.deleteTransfersBO(id,function(data)
			{
				if(data)
				{ 
					Ext.Msg.alert('成功',"操作成功！"); 
					transfersDS.load({params:{start:0,limit:17,'<%=Constant.BTS_CODE%>':'<%=strbtscode%>'}});	 
					//transfersFormPanel.getForm().reset();			
				}else
				{
					Ext.Msg.alert("失败","操作失败!");
				}
			})
		}
	})	
}


Ext.onReady(function(){  
	Ext.QuickTips.init();
	Ext.form.Field.prototype.msgTarget = 'side';

	var transferType = Ext.data.Record.create([								
							   {name: 'id', type: "string"},
							   {name: 'btscode', type: "string"},
							   {name: 'btsname', type: "string"},
							   {name: 'transAF', type: "string"},
							   {name: 'SDHAF', type: "string"},
							   {name: 'PDHAF', type: "string"},
							   {name: 'microwaveAF',  type: 'string'},
							   {name: 'otherAF', type: "string"},
							   {name: 'SDHAM', type: "string"},
							   {name: 'PDHAM', type: 'string'},
							   {name: 'microwaveAM', type: 'string'},
							   {name: 'otherAM',  type: 'string'},
							   {name: 'voltageA',  type: 'string'},
							   {name: 'propertyA',  type: 'string'},
							   {name: 'opentimeA',  type: 'date'},
							   {name: 'distODFAF',  type: 'string'},
							   {name: 'distDDFAF',  type: 'string'},
							   {name: 'distcomtankAF',  type: 'string'},
							   {name: 'distotherAF',  type: 'string'},
							   {name: 'distODFAM',  type: 'string'},
							   {name: 'distDDFAM',  type: 'string'},
							   {name: 'distcomtankAM',  type: 'string'},
							   {name: 'distotherAM',  type: 'string'},
							   {name: 'ele2MCNum',  type: 'string'},
							   {name: 'ele2MUNum',  type: 'string'},
							   {name: 'ele2MAUNum',  type: 'string'},
							   {name: 'ele2MUidx',  type: 'string'},
							   {name: 'ele2MUTimeSlot',  type: 'string'},
							   {name: 'maintenance',  type: 'string'},
							   {name: 'refreshtime',  type: 'date'},
							   {name: 'memo',  type: 'string'},
							   {name: 'str2MUseSta',  type: 'string'},
							   {name: 'portid',  type: 'string'},
							   {name: 'useinfo',  type: 'string'},
							   {name: 'isPowerAlone',  type: 'string'}
						 ]); 
	var transferCM = new Ext.grid.ColumnModel(
			[
				new Ext.grid.CheckboxSelectionModel({singleSelect: true}), 	            
				{header: "流水号", sortable: true, dataIndex: 'id',align:'left'},
				{header: "基站编号", sortable: true, dataIndex: 'btscode',align:'left'},
				{header: "基站名称",  sortable: true, dataIndex: 'btsname',align:'left'},	
				{header: "传输方式",  sortable: true, dataIndex: 'transAF',align:'left'},	 				
				{header: "删除", dataIndex: 'id',renderer: showDelete}					
			]
		);				 
	
	function showDelete(id)
	{
		return "<input type='button' value='删除' class='x-btn button' onclick='doTransferDelete(\"" + id  +   "\")'>";  
	}
	
	
	
	transfersDS = new Ext.data.Store({
				proxy: new Ext.data.DWRProxy(JTransfersWeb.getTransfersList, true),	
				reader: new Ext.data.ListRangeReader({
					totalProperty: 'totalSize',
					id: 'id'
				}, transferType),
				sortInfo:{field:'id', direction:'ASC'}// 排序信息
			});

	
	var towerMountedGridDiv = Ext.get("mainTabPanelDIV");
	var transfersGrid = new Ext.grid.GridPanel({			 	
			ds: transfersDS,
			cm: transferCM, 
			sm: new Ext.grid.RowSelectionModel({
                    singleSelect: true,
                    listeners: {
                        rowselect: function(sm, row, rec) {
                            transfersFormPanel.getForm().loadRecord(rec);
							choosedTransferID = rec.get("id");
							cuitButton.enable();	
							//loadTCdata(cDS,choosedTransferID);
                        }
                    }
                }),
			autoWidth : true,  
			autoScroll : true,  
			autoHeight　: false,
			region : 'center',
			height: 400,
			minSize: 200,		
			frame:true,
			collapsible:false, 
			enableDragDrop:false, 		
			bbar: new Ext.PagingToolbar({
					pageSize: 17,
					store: transfersDS,
					displayInfo: true,
					displayMsg: '显示第 {0} 条到 {1} 条记录，一共 {2} 条',
					emptyMsg: "没有记录"
				})
		});
		
	transfersDS.on('load', function() {
		transfersGrid.getSelectionModel().selectFirstRow(); 
	});		

	var transAFStore  = new Ext.data.Store({  
			proxy:new Ext.data.DWRProxy(JCommWeb.getDirctoryByType,{}),  
			reader:new Ext.data.DWRArrayReader(
					{},
					new Ext.data.Record.create([  
						{name: 'text', mapping:1},       
						{name: 'value',mapping:0}                   
					  ])
					)  
		});
	var transAFCombo = new Ext.form.ComboBox({	   
		fieldLabel: '传输方式（A站）',
		name: 'transAF',	
		width:100,
		valueField :"value",
	    displayField: "text",
	    mode: 'local',
		selectOnFocus:true,                    
		forceSelection: true, 
		hiddenName:'transAF',
		triggerAction: 'all', 
		editable:false, 
		store: transAFStore
	});
	transAFStore.on('beforeload', function() {
			  transAFStore.baseParams = {
					DIRECTORY_TYPE:'22'   
			  };
		});	
	transAFStore.load({params:{DIRECTORY_TYPE:'22'}});	


	var propertyAStore  = new Ext.data.Store({  
			proxy:new Ext.data.DWRProxy(JCommWeb.getDirctoryByType,{}),  
			reader:new Ext.data.DWRArrayReader(
					{},
					new Ext.data.Record.create([  
						{name: 'text', mapping:1},       
						{name: 'value',mapping:0}                   
					  ])
					)  
		});
	var propertyACombo = new Ext.form.ComboBox({	   
		fieldLabel: '传输设备所有权（A站）',
		name: 'propertyA',	
		width:100,
		valueField :"value",
	    displayField: "text",
	    mode: 'local',
		selectOnFocus:true,                    
		forceSelection: true, 
		hiddenName:'propertyA',
		triggerAction: 'all', 
		editable:false, 
		store: propertyAStore
	});
	propertyAStore.on('beforeload', function() {
			  propertyAStore.baseParams = {
					DIRECTORY_TYPE:'23'   
			  };
		});	
	propertyAStore.load({params:{DIRECTORY_TYPE:'23'}});	

	
	var str2MUseStaData = [['0', '否'],['1', '是']];
        
	var str2MUseStaStore = new Ext.data.SimpleStore({
		    fields: ['value', 'text'],
		    data : str2MUseStaData
		});		
			
	var str2MUseStaCombo = new Ext.form.ComboBox({	   
		fieldLabel: '抽取A站基站时隙',
		name: 'str2MUseSta',	
		width:100,
		valueField :"value",
	    displayField: "text",
	    mode: 'local',
		selectOnFocus:true,                    
		forceSelection: true, 
		hiddenName:'str2MUseSta',
		triggerAction: 'all', 
		editable:false, 
		store: str2MUseStaStore
	}); 	
	
	var isPowerAloneCombo = new Ext.form.ComboBox({	   
		fieldLabel: '是否独立供电',
		name: 'isPowerAlone',	
		width:100,
		valueField :"value",
	    displayField: "text",
	    mode: 'local',
		selectOnFocus:true,                    
		forceSelection: true, 
		hiddenName:'isPowerAlone',
		triggerAction: 'all', 
		editable:false, 
		store: str2MUseStaStore
	});
	
		
	var cType = Ext.data.Record.create([								
							   {name: 'id', type: "string"},
							   {name: 'transfersid', type: "string"}, 
							   {name: 'portid', type: "string"}, 
							   {name: 'cfunction',  type: 'string'}
						 ]); 
	var cSM = new Ext.grid.CheckboxSelectionModel({singleSelect: true});						
	var cCM = new Ext.grid.ColumnModel(
			[    
				//{header: "id", width: 50,dataIndex: 'id',align:'left'},
				cSM, 	
				{header: "端口号", width: 130, dataIndex: 'portid',align:'left',editor: new Ext.form.TextField({allowBlank: false})},	
				{header: "用途", width: 100, dataIndex: 'cfunction',align:'left',editor: new Ext.form.TextField({allowBlank: false})}				
			]
		);				 
		 
	var cDS = new Ext.data.Store({
				proxy: new Ext.data.DWRProxy(JTransfersWeb.getTransferscircuitBOList, true),	
				reader: new Ext.data.ListRangeReader({
					totalProperty: 'totalSize',
					id: 'id'
				}, cType),
				sortInfo:{field:'id', direction:'ASC'}// 排序信息
			});
		 
	var cGrid = new Ext.grid.EditorGridPanel({			 	
			ds: cDS,
			cm: cCM, 
			autoWidth : true,  
			autoScroll : true,  
			autoHeight　: false,
			region : 'center',
			width:300,
			height: 250,
			minSize: 200,		
			frame:true,
			clicksToEdit:2,
			sm: cSM,
			tbar: [
				{
					text: '添加',
					iconCls: 'silk-add',
					handler: onAdd
				}, 
				'-', 
				{
					text: '删除',
					iconCls: 'silk-delete',
					handler: onDelete
				}, 
				'-'
			],
				
			bbar: new Ext.PagingToolbar({
					pageSize: 10,
					store: cDS,
					displayInfo: true,
					displayMsg: '显示第 {0} 条到 {1} 条记录，一共 {2} 条',
					emptyMsg: "没有记录"
				})
		});

	function len(s) { 
		var l = 0; 
		var a = s.split(""); 
		for (var i=0;i<a.length;i++) { 
			if (a[i].charCodeAt(0)<299) { 
				l++; 
			} else { 
				l+=2; 
			} 
		} 
		return l; 
	} 	
	
	
	
	// 单元格编辑后事件处理
	cGrid.on("afteredit", afterEdit, cGrid);
	// 事件处理函数
	function afterEdit(e) {
		var record = e.record;
        var TBO = {};
		var portid = record.get("portid");
		if(len(portid)>12)
		{
			Ext.Msg.show({
                title: '提示',
                msg: '端口号号的长度不能大于20。',
                modal: false,
                icon: Ext.Msg.WARNING,
                buttons: Ext.Msg.OK
            });
			record.set(e.field, e.originalValue);
			return false;
		}
		
		TBO.id = record.get("id");
		TBO.transfersid = choosedTransferID;
		TBO.portid = portid;
		var cfunction = record.get("cfunction"); 
		//alert(cfunction);
		TBO.cfunction = cfunction;
		JTransfersWeb.saveTransferscircuitBO(TBO,function(data){
  	     	loadTCdata(cDS,choosedTransferID);
        });
	};
		
		
	/**
     * onAdd
     */
    function onAdd(btn, ev) {        
		var Plant = cGrid.getStore().recordType;	
		var TotalCount = cGrid.getStore().getTotalCount()+1;
		var p = new Plant({
                    //id : '',
					portid: ""+TotalCount,
					cfunction: ""
                });

		cGrid.stopEditing();	
        cGrid.store.insert(0, p);      
		cGrid.startEditing(0, 0);
		
		
		var TBO = {};//  
		TBO.transfersid = choosedTransferID;
		TBO.portid = ""+TotalCount;
		TBO.cfunction = ""; 
		JTransfersWeb.saveTransferscircuitBO(TBO,function(data){
  	     	loadTCdata(cDS,choosedTransferID);
        });
		
		
    }
    /**
     * onDelete
     */
    function onDelete() {
        var rec = cGrid.getSelectionModel().getSelected();
        if (!rec) {
			Ext.Msg.show({
                title: '提示',
                msg: '请选择需要删除的电路使用情况，再点击删除按钮。',
                modal: false,
                icon: Ext.Msg.WARNING,
                buttons: Ext.Msg.OK
            });

            return false;
        }       
		JTransfersWeb.deleteTransferscircuitBO(rec.get("id"),function(data){
  	     	loadTCdata(cDS,choosedTransferID);
			cGrid.store.remove(rec);
        });
    }
	
	
	var win = new Ext.Window({
					//el:'hello-win',
					layout:'fit',
					width:450,
					height:300,
					closeAction:'hide',
					plain: true,
					modal:true,
					items:cGrid,		
					buttons: [
						{
							text:'确&nbsp;&nbsp;定',
							handler: function()
							{								 
								win.hide();
							}
						}]
				});	
	var cuitButton = new Ext.Button({
						pressed : true,
	                    enableToggle : true,
	                    text : '电路使用情况',
	                    toggleHandler:doShow
			});
		
	cuitButton.disable();	
	function doShow()
	{	     
		win.show();				
		loadTCdata(cDS,choosedTransferID);			
	}
	
	// Setup the form panel
	transfersFormPanel = new Ext.form.FormPanel({
		region     : 'south', 
		bodyStyle  : 'padding: 10px; background-color: #DFE8F6',  
		height: 200,
		minSize: 200,
		maxSize: 250,
		frame:true,
		buttonAlign:'right',
		layout:'column', 
		items:[
			{
				layout:'column', 
				items:[
					 {
						columnWidth:.30,
						layout: 'form',  
						labelAlign:'right',	
						labelWidth:70,	 
						items: [
							{
								xtype:'hidden',
								fieldLabel: '流水号',
								width:150,
								name: 'id'
							}, {
								xtype:'textfield', 
								fieldLabel: '基站编号', 
								width:150,
								name: 'btscode'
							}]
					 },
					 {
						columnWidth:.30,
						layout: 'form',  
						labelAlign:'right',	
						labelWidth:70,	 
						items: [
							{ 
								xtype:'textfield',
								fieldLabel: '基站名称',
								width:150,
								readOnly: true,
								name: 'btsname'
							}]
					 },
					 {
						columnWidth:.30,
						layout: 'form',  
						labelWidth:100,	 
						labelAlign:'right',	
						items:transAFCombo
					 },
					 {
						columnWidth:.10,
						layout: 'form',  
						labelWidth:100,	 
						labelAlign:'right',	
						items:cuitButton
					 }
				]
			},
			{
				xtype:'tabpanel',
				plain:true,
				activeTab: 0,
				height:120, 
				deferredRender: false,
				defaults:{bodyStyle:'padding:10px'},
				items:[
					{
						title:'传输设备厂家（A站）',
						frame:true,
						labelAlign:'right',
						layout:'column', 
						items:[
							 {
								columnWidth:.33,
								layout: 'form',  
								labelWidth:100,	 
								labelAlign:'right',	
								items: [
									{
										xtype:'textfield', 
										fieldLabel: 'SDH', 										
										width:150,
										name: 'SDHAF'
									},{
										xtype:'textfield', 
										fieldLabel: '其它', 										
										width:150,
										name: 'otherAF'
									}]
							 },
							 {
								columnWidth:.33,
								layout: 'form',  
								labelAlign:'right',	
								labelWidth:70,	 
								items: [
									{
										xtype:'textfield',
										fieldLabel: 'PDH',
										width:150,
										name: 'PDHAF'
									}]
							 },
							 {
								columnWidth:.34,
								layout: 'form',  
								labelAlign:'right',	
								labelWidth:70,	 
								items: [
									{
										xtype:'textfield',
										fieldLabel: '微波',
										width:150, 
										name: 'microwaveAF'
									}]
							 }
						]
					},{
						title:'传输设备型号（A站）',
						frame:true,
						layout:'column', 
						labelAlign :'right',
						items:[
							 {
								columnWidth:.25,
								layout: 'form',  
								labelAlign:'right',	
								labelWidth:100,	 
								items: [
									{
										xtype:'textfield', 
										fieldLabel: 'SDH', 
										width:100,
										name: 'SDHAM'
									},{
										xtype:'textfield',
										fieldLabel: 'PDH',
										width:100,
										name: 'PDHAM'
									}]
							 },
							 {
								columnWidth:.25,
								layout: 'form',  
								labelWidth:100,	 
								labelAlign:'right',	
								items: [
									{
										xtype:'numberfield', 
										fieldLabel: '传输设备使用电源电压（A站）', 
										width:100,
										decimalPrecision:2,
										value:1,
										name: 'voltageA'
									},
									propertyACombo
									]
							 },
							 {
								columnWidth:.25,
								layout: 'form',  
								labelWidth:100,	 
								labelAlign:'right',	
								items: [									
									{
										xtype:'datefield',
										format : "Y-m-d",
										fieldLabel: '传输设备启用时间（A站）',
										width:100,
										name: 'opentimeA'
									},
									{
										xtype:'textfield',
										fieldLabel: '其它',
										width:100,
										name: 'otherAM'
									}]
							 },
							 {
								columnWidth:.25,
								layout: 'form',  
								labelAlign:'right',	
								labelWidth:70,	 
								items: [
									{
										xtype:'textfield',
										fieldLabel: '微波',
										width:100,
										name: 'microwaveAM'
									}]
							 }
						]
					},{
						title:'传输设备配线架厂家（A站）',
						frame:true,
						layout:'column', 
						labelAlign :'right',
						items:[
							 {
								columnWidth:.25,
								layout: 'form',  
								labelAlign:'right',									
								labelWidth:100,	 
								items: [
									{
										xtype:'textfield', 
										fieldLabel: 'ODF架', 
										width:100,
										name: 'distODFAF'
									}]
							 },
							 {
								columnWidth:.25,
								layout: 'form',  
								labelAlign:'right',	
								labelWidth:70,	 
								items: [
									{
										xtype:'textfield',
										fieldLabel: 'DDF架',
										width:100,
										name: 'distDDFAF'
									}]
							 },
							 {
								columnWidth:.25,
								layout: 'form',  
								labelAlign:'right',	
								labelWidth:70,	 
								items: [
									{
										xtype:'textfield',
										fieldLabel: '综合柜',
										width:100,
										value:1,
										name: 'distcomtankAF'
									}]
							 },
							 {
								columnWidth:.25,
								layout: 'form',  
								labelAlign:'right',	
								labelWidth:70,	 
								items: [
									{
										xtype:'textfield',
										fieldLabel: '其它',
										width:100, 
										name: 'distotherAF'
									}]
							 }
						]
					},{
						title:'传输设备配线架型号（A站）',
						frame:true,
						layout:'column', 
						labelAlign :'right',
						items:[
							 {
								columnWidth:.25,
								layout: 'form',  
								labelAlign:'right',	
								labelWidth:100,	 
								items: [
									{
										xtype:'textfield', 
										fieldLabel: 'ODF架', 
										width:100,
										name: 'distODFAM'
									}]
							 },
							 {
								columnWidth:.25,
								layout: 'form',  
								labelAlign:'right',	
								labelWidth:70,	 
								items: [
									{
										xtype:'textfield',
										fieldLabel: 'DDF架',
										width:100,
										name: 'distDDFAM'
									}]
							 },
							 {
								columnWidth:.25,
								layout: 'form',  
								labelAlign:'right',	
								labelWidth:70,	 
								items: [
									{
										xtype:'textfield',
										fieldLabel: '综合柜',
										width:100,
										name: 'distcomtankAM'
									}]
							 },
							 {
								columnWidth:.25,
								layout: 'form',  
								labelAlign:'right',	
								labelWidth:70,	 
								items: [
									{
										xtype:'textfield', 
										fieldLabel: '其它',
										width:100,
										name: 'distotherAM'
									}]
							 }
						]
					},{
						title:'电路使用情况',
						frame:true,
						layout:'column', 
						labelAlign :'right',
						items:[
							 {
								columnWidth:.50,
								layout: 'form',  
								labelAlign:'right',	
								labelWidth:100,	 
								items: [
									{
										xtype:'textfield', 
										fieldLabel: '端口号', 
										width:100,
										name: 'portid'
									}]
							 },
							 {
								columnWidth:.50,
								layout: 'form',  
								labelAlign:'right',	
								labelWidth:70,	 
								items: [
									{
										xtype:'textfield',
										fieldLabel: '用途',
										width:100,
										name: 'useinfo'
									}]
							 }  
						]
					},{
						title:'电路配置及使用情况',
						frame:true,
						layout:'column', 
						labelAlign :'right',
						items:[
							 {
								columnWidth:.25,
								layout: 'form', 
								labelAlign:'right',									
								labelWidth:100,	 
								items: [
									{
										xtype:'numberfield', 
										value:1,
										fieldLabel: '2M电路配置数量', 
										width:100,
										name: 'ele2MCNum'
									}]
							 },
							 {
								columnWidth:.25,
								layout: 'form',  
								labelAlign:'right',	
								labelWidth:100,	 
								items: [
									{
										xtype:'numberfield', 
										value:1,
										fieldLabel: '2M电路使用数量',
										width:100,
										name: 'ele2MUNum'
									}]
							 },
							 {
								columnWidth:.25,
								layout: 'form',  
								labelAlign:'right',	
								labelWidth:100,	 
								items: [
									{
										xtype:'numberfield',
										fieldLabel: 'A站2M使用数量',
										width:100,
										value:1,
										name: 'ele2MAUNum'
									}]
							 },
							 {
								columnWidth:.25,
								layout: 'form',  
								labelAlign:'right',	
								labelWidth:100,	 
								items: [
									{
										xtype:'numberfield',
										fieldLabel: '2M电路使用情况',
										value:1,
										width:100,
										name: 'ele2MUidx'
									}]
							 }
						]
					},{
						title:'B站电路使用情况',
						frame:true,
						layout:'column', 
						labelAlign :'right',
						items:[
							 {
								columnWidth:.25,
								layout: 'form',  
								labelAlign:'right',	
								labelWidth:100,	 
								items: [
									{
										xtype:'textfield', 
										fieldLabel: '使用A站第几对2M', 
										width:100,
										name: 'ele2MUTimeSlot'
									},{
										xtype:'textarea', 
										fieldLabel: '备注', 
										width:100,
										name: 'memo'
									}]
							 },
							 {
								columnWidth:.25,
								layout: 'form',  
								labelAlign:'right',	
								labelWidth:100,	 
								items: [
									str2MUseStaCombo]
							 },
							 {
								columnWidth:.25,
								layout: 'form',  
								labelAlign:'right',	
								labelWidth:100,	 
								items: [
									{
										xtype:'textfield',
										fieldLabel: '传输设备更换记录', 
										width:100,
										name: 'maintenance'
									}]
							 },
							 {
								columnWidth:.25,
								layout: 'form',  
								labelAlign:'right',	
								labelWidth:100,	 
								items:isPowerAloneCombo
							 }
						]
					}]
			}	 
			],
		buttons :[
			{
				text : ' 保存',
				handler : saveTransfer
			},{
				text : ' 新建/取消',
				handler : function(){
					transfersFormPanel.getForm().reset();  
					transfersFormPanel.getForm().loadRecord(recordForAll);	
				}
			}
			]	
	});



	//Simple 'border layout' panel to house both grids
	
	var displayPanel = new Ext.Panel({
		width    : towerMountedGridDiv.getComputedWidth(),
		height   : 500,
		layout   : 'border',
		renderTo : 'TransfersTab',
		items    : [
			transfersGrid,
			transfersFormPanel
		]
	});
	
	
	function saveTransfer()
	{
		if (!transfersFormPanel.getForm().isValid())
			return;	
			
		var form = transfersFormPanel.getForm().getValues(false);	
		var transferBO = {};
		transferBO.id = form.id;
		transferBO.btscode = form.btscode;
		transferBO.btsname= form.btsname;
		transferBO.transAF = form.transAF;		
		transferBO.SDHAF = form.SDHAF;
		transferBO.PDHAF = form.PDHAF;
		transferBO.microwaveAF = form.microwaveAF;
		transferBO.otherAF = form.otherAF;
		transferBO.SDHAM = form.SDHAM;
		transferBO.PDHAM = form.PDHAM;
		transferBO.microwaveAM = form.microwaveAM; 
		transferBO.otherAM = form.otherAM;
		transferBO.voltageA = form.voltageA; 
		transferBO.propertyA = form.propertyA; 
	
		
		var opentimeA = form.opentimeA; 
		if(opentimeA != "undefined" && opentimeA != "")
		{
			var opentimeDate = new Date();	
			var arrPlanTime = opentimeA.split("-");						
			var yearOth = arrPlanTime[0];
			var monthOth = arrPlanTime[1];
			var dayOth = arrPlanTime[2];
			opentimeDate.setFullYear(yearOth,monthOth-1,dayOth);			
			transferBO.opentimeA = opentimeDate;
		}else
			transferBO.opentimeA = new Date();
		
		
		transferBO.distODFAF = form.distODFAF; 
		transferBO.distDDFAF = form.distDDFAF; 
		transferBO.distcomtankAF = form.distcomtankAF; 
		transferBO.distotherAF = form.distotherAF; 
		transferBO.distODFAM = form.distODFAM; 
		transferBO.distDDFAM = form.distDDFAM; 
		transferBO.distcomtankAM = form.distcomtankAM; 
		transferBO.distotherAM = form.distotherAM; 
		transferBO.ele2MCNum = form.ele2MCNum;
		transferBO.ele2MUNum = form.ele2MUNum; 
		transferBO.ele2MAUNum = form.ele2MAUNum; 
		transferBO.ele2MUidx = form.ele2MUidx; 
		transferBO.ele2MUTimeSlot = form.ele2MUTimeSlot; 
		transferBO.maintenance = form.maintenance; 
		transferBO.str2MUseSta = form.str2MUseSta; 
		transferBO.isPowerAlone = form.isPowerAlone;  
		transferBO.memo = form.memo; 
		
		transferBO.portid = form.portid;
		transferBO.useinfo = form.useinfo;
		 
			
		JTransfersWeb.saveTransfersBO(transferBO,function(data)
		{
			if(data)
			{ 
				Ext.Msg.alert('成功',"操作成功！"); 
				loadDate(transfersDS,transfersFormPanel);		 
			}else
			{
				Ext.Msg.alert("失败","操作失败!");
			}
		})
			
	}
	
	loadDate(transfersDS,transfersFormPanel);	
	
})